#ifndef __0685A7E5_ED1F_46b0_8F45_21D4F1386AD8__
#define __0685A7E5_ED1F_46b0_8F45_21D4F1386AD8__

#include <cstdarg>
#include <cstdio>

/////////////////////////////////////////////////////////////////////////////////////////
// 
namespace xos
{
    // 
    // crt interface
    // 
    class i_crt
    {
    public:
        virtual ~i_crt(){}

    public:
        virtual const char * strrstr( const char * lpszStr, const char * lpszSubStr, bool bCaseSensitive ) = 0;
        virtual const char * strstr( const char * lpszStr, const char * lpszSubStr, bool bCaseSensitive ) = 0;

        virtual char * strrstr( char * lpszStr, const char * lpszSubStr, bool bCaseSensitive ) = 0;
        virtual char * strstr( char * lpszStr, const char * lpszSubStr, bool bCaseSensitive ) = 0;

        virtual const char * strrchr( const char * lpszStr, char c ) = 0;
        virtual const char * strchr( const char * lpszStr, char c ) = 0;

        virtual char * strrchr( char * lpszStr, char c ) = 0;
        virtual char * strchr( char * lpszStr, char c ) = 0;

        virtual int vsnprintf( char * lpszBuf, int nLen, const char * format, va_list argptr ) = 0;
        virtual int sprintf( char * buf, int nLen, const char * lpszFormat, ... ) = 0;
        virtual int gets( char * lpszBuf, int nLen ) = 0;

        virtual double atof( const char * lpszStr ) = 0;
        virtual xos_i64 atoi64( const char * lpszStr ) = 0;
        virtual int atoi( const char * lpszStr ) = 0;

        // 
        // nLen include the last '\0'
        // 
        virtual char * strncpy( char * lpszDst, int nLen, const char * lpszSrc ) = 0;
        virtual char * strcpy( char * lpszDst, const char * lpszSrc ) = 0;

        virtual char * strcat( char * lpszDst, const char * lpszSrc ) = 0;
        virtual int strlen( const char * lpszStr ) = 0;

        virtual int stricmp( const char * lpszStr1, const char * lpszStr2 ) = 0;
        virtual int strcmp( const char * lpszStr1, const char * lpszStr2 ) = 0;

        virtual int assert_valid( bool bAssert ) = 0;

        // 
        // if uSeed is 0, sys will add seed
        // 
        virtual int srand( xos::xos_u32 uSeed ) = 0;
        virtual int rand( int nMax ) = 0;

        // 
        // release
        // 
        virtual int release() = 0;
    };
}

#endif // __0685A7E5_ED1F_46b0_8F45_21D4F1386AD8__
